<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>url组成</title>
    <style>.active{color:red}</style>
<body>
   
    
    <script> 
//   整个地址
console.log(location.href);
//  协议
console.log(location.protocol);
// 域名
console.log(location.host);
// 查询
console.log(location.search);
// 哈希值
console.log(location.hash);
// 路径
console.log(location.pathname);

// url编码


    </script>

</body>
</html>